package algorithm.ACO_algo.util;

import java.text.ParseException;
import java.util.Date;

public class Timefunction {
    public static boolean isLess(Date d1, Date d2) throws ParseException {
        boolean res;
        if (d1.getTime() < d2.getTime()){
            res = true;
        }
        else{
            res = false;
        }
        return res;
    }

    public static int getSecondInterval(Date st, Date ed) {

        long second = 0;
        second = (st.getTime() - ed.getTime()) /  1000;
        return (int)second ;
    }

    public static Date TimeCal(Date s, int du) throws ParseException {
        long time = du * 1000;
        Date afterDate = new Date(s .getTime() + time);
        return afterDate;
    }
}

